#ifndef VERTEXBUFFEROBJECT_H
#define VERTEXBUFFEROBJECT_H

#include "bga/graphics/GLObject.h"

/**
 * \namespace bga
 * \brief API namespace
 */
namespace bga
{

/*! \class VertexBufferObject
*   \brief Class which contains OpenGL VBO operations
*/
class VertexBufferObject : public GLObject // TODO si jamais implementation des PBO faire une classe mere BufferObject pour les PBO et les VBO qui herite de GLObject
{
    public:
        VertexBufferObject();

        virtual ~VertexBufferObject();

        /*!
         * \brief Bind the VBO
         */
        virtual void bind() const;

        /*!
         * \brief Unbind the VBO
         */
        virtual void unbind() const;

        /*!
         * \brief allocate VBO memory
         */
        void allocateBuffer(GLsizei size) const;

        /*!
         * \brief set VBO data
         */
        void setData(GLint first, GLsizei size, const GLvoid* data) const;

        /*!
         * \brief set fbo target
         */
        void setTarget(GLenum target);
        GLenum getTarget() const;

        /*!
         * \brief set fbo
         */
        void setMode(GLenum mode);
        GLenum getMode() const;

    private:
        virtual GLuint generate() const;

    private:
        GLenum target; /// the VBO target (GL_ARRAY_BUFFER_ARB or GL_ELEMENT_ARRAY_BUFFER_ARB)

        GLenum mode; /// the VBO mode
};

}

#endif
